<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>部门管理页面</title>
</head>
<body>
<div class="hrms_dept_container">
    <!-- 导航栏-->
    <%@ include file="./commom/head.jsp"%>


    <!-- 中间部分（左侧栏+表格内容） -->
    <div class="hrms_dept_body">
        <!-- 左侧栏 -->
        <%@ include file="./commom/leftsidebar.jsp"%>

        <!-- 部门表格内容 -->
        <div class="dept_info col-sm-10">
  <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">部门新增</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal add_dept_form">
                         <div class="form-group">
                        <label for="add_deptName" class="col-sm-2 control-label">部门编号</label>
                        <div class="col-sm-8">
                            <input type="text" name="deptId" value="${dept.deptId }" class="form-control" id="add_deptId" disabled="disabled">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="add_deptName" class="col-sm-2 control-label">部门名称</label>
                        <div class="col-sm-8">
                            <input type="text" name="deptName" value="${dept.deptName }" class="form-control" id="add_deptName" placeholder="人事部">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="add_deptLeader" class="col-sm-2 control-label">部门老大</label>
                        <div class="col-sm-8">
                            <input type="text" name="deptLeader" value="${dept.deptLeader }" class="form-control" id="add_deptLeader" placeholder="XXX">
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" style="width:100px" class="btn btn-primary dept_save_btn2">保存</button>
            </div>
        </div><!-- /.modal-content -->

        </div><!-- /.dept_info -->
    </div><!-- /.hrms_dept_body -->


</div><!-- /.hrms_dept_container -->

<script type="text/javascript">
    <!-- ==========================部门新增操作=================================== -->

    $(".dept_save_btn2").click(function () {
        var deptName = $("#add_deptName").val();
        var deptLeader = $("#add_deptLeader").val();
        //验证省略...
        $.ajax({
            url:"/HRMS/dept/deptupdate",
            type:"post",
            data:{"deptId":$("#add_deptId").val(),"deptName":$("#add_deptName").val(),
            	"deptLeader":$("#add_deptLeader").val()},
            success:function (result) {
                if(result.code == "true"){
                    alert("修改成功");
                   window.location.href="${pageContext.request.contextPath}/dept/depart.html";
                }else {
                    alert("修改失败");
                }
            }
        });



    });



</script>

</body>
</html>
